const Router = require('koa-router')
const { upload, create, update, remove, restore, findAll } = require('../controller/goods.controller')
const { auth, hadAdminPermission } = require('../middleware/auth.middleware')
const { validator } = require('../middleware/goods.middleware')
const router = new Router({ prefix: "/goods" })

router.post('/upload', auth, hadAdminPermission, upload)
router.post('/publish', auth, hadAdminPermission, validator, create)
router.put('/:id', auth, hadAdminPermission, validator, update)
router.post('/:id/off', auth, hadAdminPermission, remove)
router.post('/:id/on', auth, hadAdminPermission, restore)
router.get('/', findAll)

// router.post('/upload', upload)
// router.post('/publish', create)
// router.put('/:id', update)
// router.post('/:id/off', remove)
// router.post('/:id/on', restore)
// router.get('/', findAll)

module.exports = router
